define('admin/js/mod/system/Config', [
    'utils/fetchEnhancer',
    'utils/helpers'], (fetch, helpers) => {

const Config = {
    data: function() {
        return {
            config: ''
        }
    },
    methods: {
        fetchData: function() {
            let _self = this;

            fetch('/adminapi/getsystemconfig').then(function(json){
                if(0 === json.status) {
                    _self.config = json.data.data;
                }
            });
        },
        doEdit: function() {
            let _self = this;

            fetch('/adminapi/editsystemconfig', {
                method: 'POST',
                body: 'data=' + encodeURIComponent(this.config)
            }).then(function(json){
                if(0 === json.status) {
                    _self.$message.success('操作成功');
                } else {
                    _self.$message.error('操作失败');
                }
            });
        }
    },
    mounted: function() {
        this.fetchData();
    },
    template:
`<div>
    <div style="padding: 10px 0">
        <el-button size="medium" type="primary" @click="doEdit">提交</el-button>
    </div>
    <el-input
        style="font-size: 16px"
        type="textarea"
        :rows="50"
        v-model="config">
    </el-input>
</div>`
};

return Config;

});
